package xiao_jin.fantastic_journey.client.mixin;

import club.someoneice.cookie.event.EventBus;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import xiao_jin.fantastic_journey.core.handler.ItemTooltipEvent;

import java.util.List;

@Environment(EnvType.CLIENT)
@Mixin(Item.class)
public class ItemMixin {
    @Inject(method = "appendTooltip", at = @At("TAIL"))
    public void appendTooltipMethod(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type, CallbackInfo ci) {
        EventBus.post(new ItemTooltipEvent(stack, tooltip, context));
    }
}
